from appium import webdriver

from pages.main_page import MainPage


class App:

    def start_app(self):
        desire_caps = {
            "platformName": "android",
            "appPackage": "com.tencent.wework",
            "appActivity": ".launch.WwMainActivity",
            "noReset": True,
            "skipDeviceInitialization": True,
            "unicodeKeyBoard": True
        }

        self.driver = webdriver.Remote("http://127.0.0.1:4723/wd/hub", desire_caps)
        self.driver.implicitly_wait(5)

        return self

    def stop_app(self):
        self.driver.quit()

    def go_to_main(self):
        return MainPage(self.driver)